﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _14CalculatingArrays
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            Console.WriteLine("The max member of the array is:{0}", MaxOfArray(array));
            Console.WriteLine("The min member of the array is:{0}", MinOfArray(array));
            Console.WriteLine("The sum of the array is:{0}", ArraySum(array));
            Console.WriteLine("The average of the array is:{0}", ArrayAverage(array));
            Console.WriteLine("The product of the array is:{0}", ArrayProduct(array));
        }

        static int ArrayProduct(int[] array)
        {
            int product = 1;
            for (int i = 0; i < array.Length; i++)
            {
                product *= array[i];
            }
            return product;
        }

        static int ArraySum(int[] array)
        {
            int sum = 0;
            for (int i = 0; i < array.Length; i++)
            {
                sum += array[i];
            }
            return sum;
        }

        static int ArrayAverage(int[] array)
        {
            int sum = 0;
            int ave;
            for (int i = 0; i < array.Length; i++)
            {
                sum += array[i];
            }
            ave = sum / array.Length;
            return ave;
        }

        static int MinOfArray(int[] array)
        {
            int miNum = int.MaxValue;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] < miNum)
                {
                    miNum = array[i];
                }
            }
            return miNum;
        }

        static int MaxOfArray(int[] array)
        {
            int maxNum = int.MinValue;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] > maxNum)
                {
                    maxNum = array[i];
                }
            }
            return maxNum;
        }
    }
}
